import { defineComponent, computed, ref, resolveComponent, openBlock, createElementBlock, createBlock, isRef, unref, withCtx, createCommentVNode, createVNode, createTextVNode } from "vue";
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
var _export_sfc = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const _hoisted_1 = { class: "pagination-container" };
const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u6240\u6709\u9875");
const _sfc_main = /* @__PURE__ */ defineComponent({
  props: {
    page: {
      type: Number,
      default: 1
    },
    limit: {
      type: Number,
      default: 1
    },
    total: {
      type: Number,
      default: 1
    },
    pageSizes: {
      type: Array,
      default: () => [10, 15, 20, 30, 50, 100, 200]
    },
    layout: {
      type: String,
      default: "total, sizes, prev, pager, next, jumper"
    },
    background: {
      type: Boolean,
      default: false
    },
    showAllChecked: {
      type: Boolean,
      default: false
    },
    allChecked: {
      type: Boolean,
      default: false
    }
  },
  emits: ["update:allChecked", "update:page", "update:limit", "current-change", "size-change"],
  setup(__props, { emit }) {
    const props = __props;
    const disableAllSize = computed(() => {
      return props.total === 0;
    });
    ref(false);
    const handleChangeAllSize = (data) => {
      emit("update:allChecked", data);
    };
    const currentChange = (data) => {
      emit("current-change", data);
    };
    const sizeChange = (data) => {
      emit("size-change", data);
    };
    return (_ctx, _cache) => {
      const _component_el_checkbox = resolveComponent("el-checkbox");
      const _component_el_pagination = resolveComponent("el-pagination");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        __props.showAllChecked ? (openBlock(), createBlock(_component_el_checkbox, {
          key: 0,
          class: "checkbox",
          modelValue: __props.allChecked,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(allChecked) ? allChecked.value = $event : null),
          onChange: handleChangeAllSize,
          disabled: unref(disableAllSize)
        }, {
          default: withCtx(() => [
            _hoisted_2
          ]),
          _: 1
        }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
        createVNode(_component_el_pagination, {
          background: __props.background,
          "current-page": __props.page,
          "onUpdate:current-page": _cache[1] || (_cache[1] = ($event) => isRef(page) ? page.value = $event : null),
          "page-size": __props.limit,
          "onUpdate:page-size": _cache[2] || (_cache[2] = ($event) => isRef(limit) ? limit.value = $event : null),
          layout: __props.layout,
          "page-sizes": __props.pageSizes,
          total: __props.total,
          small: "",
          onCurrentChange: currentChange,
          onSizeChange: sizeChange
        }, null, 8, ["background", "current-page", "page-size", "layout", "page-sizes", "total"])
      ]);
    };
  }
});
var pagination = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-257c8fd0"]]);
var index = {
  install(app) {
    app.component("bs-pagination", pagination);
  }
};
export { index as default };
